package com.briup.recognition.service.impl;


import com.briup.recognition.bean.BaseUser;
import com.briup.recognition.bean.BaseUserExample;
import com.briup.recognition.bean.CallLog;
import com.briup.recognition.bean.CallLogExample;
import com.briup.recognition.dao.BaseUserMapper;
import com.briup.recognition.dao.CallLogMapper;
import com.briup.recognition.service.IBaseUserService;
import com.briup.recognition.service.ICallLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @Author: kun
 * @Description: 调用dao层
 * @DateTime: 2021/3/28$ 23:18$
 * @Params: $
 * @Return $
 */
@Service
public class CallLogServiceImpl implements ICallLogService {
    @Resource
    private CallLogMapper callLogMapper;

    @Override
    public List<CallLog> query(){
        CallLogExample example = new CallLogExample();
        return  callLogMapper.selectByExample(example);
    }

    @Override
    public  void  saveOrUpdate(CallLog callLog){
        if(callLog.getId()!=null){
            callLogMapper.updateByPrimaryKey(callLog);
        }else {
            callLog.setCallTime(new Date().getTime());
            callLogMapper.insert(callLog);
        }
    }

    @Override
    public  void  deleteById(long id){
        callLogMapper.deleteByPrimaryKey(id);
    }

}